<template>
	<view class="content">
		<uni-nav-bar left-icon="left" color="#4a87b6" title="反馈" @clickLeft="back" background-color="#efefef"/>	
		<textarea @blur="bindTextAreaBlur"  class="textArea"  placeholder="请输入您的宝贵意见~"/>
		<button type="primary" @click="toFeedBack()">反馈给我们</button>
		<view>
					<!-- 提示窗示例 -->
			<uni-popup ref="alertDialog" type="dialog">
				<uni-popup-dialog type="warn" cancelText="关闭" title="通知" content="还没有内容哦~" ></uni-popup-dialog>
			</uni-popup>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				message:""
			};
		},
		methods:{
			back(){
				uni.navigateBack({
					delta: 1
				})
			},
			bindTextAreaBlur: function (e) {
				this.message = e.detail.value
			},
			toFeedBack(){
				if(this.message==""||this.message==NaN||/^\s+$/gi.test(this.message)){
					console.log("信息为空")
					this.dialogToggle()
				}else{
					console.log(this.message)
				}
			},
			// 警告弹出层
			dialogToggle() {
				this.$refs.alertDialog.open()
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: $bg-gary;
	}
	.content{
		.textArea{
			background-color: white;
			width: 100%;
			height: 30vh;
		}
		button{
			margin-top: 30rpx;
		}
	}
</style>
